package com.feng.system.dto;

import com.feng.common.validation.constraints.Gender;
import com.feng.common.validation.constraints.Phone;
import com.feng.common.validation.groups.Insert;
import com.feng.common.validation.constraints.OneOrZero;
import com.feng.common.validation.groups.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.util.Set;

/**
 * 增/改用户信息参数类
 * @author Feng
 * @since 2022/4/18 22:53
 */
@Data
public class UserParam {

    @NotNull(message = "请指定所用修改的用户的ID", groups = Update.class)
    @ApiModelProperty(value = "ID")
    private Long userId;

    @NotBlank(message = "用户名不能为空", groups = Insert.class)
    @ApiModelProperty(value = "用户名")
    private String username;

    @NotNull(message = "isAdmin值不能为空")
    @OneOrZero(message = "isAdmin值只能是0或1")
    @ApiModelProperty(value = "是否可登录管理系统")
    private Integer isAdmin;

    @NotNull(message = "isEnabled值不能为空")
    @OneOrZero(message = "isEnabled值只能是0或1")
    @ApiModelProperty(value = "是否启用")
    private Integer isEnabled;

    @Gender
    @ApiModelProperty(value = "性别")
    private String gender;

    @NotBlank(message = "昵称不能为空")
    @ApiModelProperty(value = "昵称")
    private String nickName;

    @Phone
    @ApiModelProperty(value = "手机号码")
    private String phone;

    @Email(message = "邮箱格式错误")
    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "头像")
    private String avatar;

    @ApiModelProperty("角色列表")
    private Set<Long> roleIds;

}
